/*
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
$(document).ready(function() {

    $(".click-title").mouseenter( function(    e){
        e.preventDefault();
        this.style.cursor="pointer";
    });
    $(".click-title").mousedown( function(event){
        event.preventDefault();
    });

    // Ugly code while this script is shared among several pages
    try{
        refreshHitsPerSecond(true);
    } catch(e){}
    try{
        refreshResponseTimeOverTime(true);
    } catch(e){}
    try{
        refreshResponseTimePercentiles();
    } catch(e){}
});


var responseTimePercentilesInfos = {
        data: {"result": {"minY": 1.0, "minX": 0.0, "maxY": 711.0, "series": [{"data": [[0.0, 1.0], [0.1, 1.0], [0.2, 2.0], [0.3, 5.0], [0.4, 9.0], [0.5, 14.0], [0.6, 15.0], [0.7, 16.0], [0.8, 18.0], [0.9, 18.0], [1.0, 19.0], [1.1, 20.0], [1.2, 22.0], [1.3, 23.0], [1.4, 23.0], [1.5, 25.0], [1.6, 26.0], [1.7, 27.0], [1.8, 27.0], [1.9, 28.0], [2.0, 28.0], [2.1, 29.0], [2.2, 29.0], [2.3, 30.0], [2.4, 30.0], [2.5, 31.0], [2.6, 31.0], [2.7, 31.0], [2.8, 31.0], [2.9, 32.0], [3.0, 32.0], [3.1, 32.0], [3.2, 33.0], [3.3, 33.0], [3.4, 33.0], [3.5, 33.0], [3.6, 34.0], [3.7, 34.0], [3.8, 35.0], [3.9, 35.0], [4.0, 35.0], [4.1, 35.0], [4.2, 36.0], [4.3, 36.0], [4.4, 36.0], [4.5, 37.0], [4.6, 37.0], [4.7, 37.0], [4.8, 37.0], [4.9, 38.0], [5.0, 38.0], [5.1, 38.0], [5.2, 38.0], [5.3, 38.0], [5.4, 38.0], [5.5, 39.0], [5.6, 39.0], [5.7, 39.0], [5.8, 40.0], [5.9, 40.0], [6.0, 40.0], [6.1, 41.0], [6.2, 41.0], [6.3, 41.0], [6.4, 41.0], [6.5, 41.0], [6.6, 41.0], [6.7, 42.0], [6.8, 42.0], [6.9, 42.0], [7.0, 42.0], [7.1, 42.0], [7.2, 42.0], [7.3, 42.0], [7.4, 43.0], [7.5, 43.0], [7.6, 43.0], [7.7, 43.0], [7.8, 43.0], [7.9, 43.0], [8.0, 43.0], [8.1, 43.0], [8.2, 44.0], [8.3, 44.0], [8.4, 44.0], [8.5, 44.0], [8.6, 44.0], [8.7, 44.0], [8.8, 44.0], [8.9, 45.0], [9.0, 45.0], [9.1, 45.0], [9.2, 45.0], [9.3, 45.0], [9.4, 46.0], [9.5, 46.0], [9.6, 46.0], [9.7, 46.0], [9.8, 46.0], [9.9, 47.0], [10.0, 47.0], [10.1, 47.0], [10.2, 47.0], [10.3, 47.0], [10.4, 47.0], [10.5, 47.0], [10.6, 48.0], [10.7, 48.0], [10.8, 48.0], [10.9, 48.0], [11.0, 48.0], [11.1, 48.0], [11.2, 48.0], [11.3, 48.0], [11.4, 49.0], [11.5, 49.0], [11.6, 49.0], [11.7, 49.0], [11.8, 49.0], [11.9, 49.0], [12.0, 50.0], [12.1, 50.0], [12.2, 50.0], [12.3, 50.0], [12.4, 51.0], [12.5, 51.0], [12.6, 51.0], [12.7, 51.0], [12.8, 51.0], [12.9, 51.0], [13.0, 51.0], [13.1, 52.0], [13.2, 52.0], [13.3, 52.0], [13.4, 52.0], [13.5, 52.0], [13.6, 52.0], [13.7, 52.0], [13.8, 52.0], [13.9, 53.0], [14.0, 53.0], [14.1, 53.0], [14.2, 53.0], [14.3, 53.0], [14.4, 54.0], [14.5, 54.0], [14.6, 54.0], [14.7, 54.0], [14.8, 54.0], [14.9, 54.0], [15.0, 54.0], [15.1, 54.0], [15.2, 54.0], [15.3, 55.0], [15.4, 55.0], [15.5, 55.0], [15.6, 55.0], [15.7, 55.0], [15.8, 55.0], [15.9, 55.0], [16.0, 56.0], [16.1, 56.0], [16.2, 56.0], [16.3, 57.0], [16.4, 57.0], [16.5, 57.0], [16.6, 57.0], [16.7, 57.0], [16.8, 57.0], [16.9, 58.0], [17.0, 58.0], [17.1, 58.0], [17.2, 58.0], [17.3, 58.0], [17.4, 59.0], [17.5, 59.0], [17.6, 59.0], [17.7, 59.0], [17.8, 59.0], [17.9, 60.0], [18.0, 60.0], [18.1, 60.0], [18.2, 60.0], [18.3, 60.0], [18.4, 60.0], [18.5, 60.0], [18.6, 61.0], [18.7, 61.0], [18.8, 61.0], [18.9, 61.0], [19.0, 62.0], [19.1, 62.0], [19.2, 62.0], [19.3, 62.0], [19.4, 63.0], [19.5, 63.0], [19.6, 63.0], [19.7, 63.0], [19.8, 63.0], [19.9, 63.0], [20.0, 64.0], [20.1, 64.0], [20.2, 64.0], [20.3, 64.0], [20.4, 64.0], [20.5, 65.0], [20.6, 65.0], [20.7, 65.0], [20.8, 65.0], [20.9, 65.0], [21.0, 65.0], [21.1, 65.0], [21.2, 65.0], [21.3, 65.0], [21.4, 65.0], [21.5, 66.0], [21.6, 66.0], [21.7, 66.0], [21.8, 66.0], [21.9, 66.0], [22.0, 66.0], [22.1, 66.0], [22.2, 66.0], [22.3, 66.0], [22.4, 66.0], [22.5, 67.0], [22.6, 67.0], [22.7, 67.0], [22.8, 68.0], [22.9, 68.0], [23.0, 68.0], [23.1, 68.0], [23.2, 68.0], [23.3, 68.0], [23.4, 68.0], [23.5, 68.0], [23.6, 68.0], [23.7, 69.0], [23.8, 69.0], [23.9, 69.0], [24.0, 69.0], [24.1, 69.0], [24.2, 69.0], [24.3, 69.0], [24.4, 69.0], [24.5, 70.0], [24.6, 70.0], [24.7, 70.0], [24.8, 70.0], [24.9, 70.0], [25.0, 70.0], [25.1, 71.0], [25.2, 71.0], [25.3, 71.0], [25.4, 72.0], [25.5, 72.0], [25.6, 72.0], [25.7, 72.0], [25.8, 72.0], [25.9, 73.0], [26.0, 73.0], [26.1, 73.0], [26.2, 74.0], [26.3, 74.0], [26.4, 74.0], [26.5, 75.0], [26.6, 75.0], [26.7, 75.0], [26.8, 75.0], [26.9, 76.0], [27.0, 76.0], [27.1, 76.0], [27.2, 76.0], [27.3, 77.0], [27.4, 77.0], [27.5, 77.0], [27.6, 77.0], [27.7, 77.0], [27.8, 77.0], [27.9, 78.0], [28.0, 78.0], [28.1, 78.0], [28.2, 78.0], [28.3, 79.0], [28.4, 79.0], [28.5, 79.0], [28.6, 80.0], [28.7, 80.0], [28.8, 81.0], [28.9, 81.0], [29.0, 81.0], [29.1, 81.0], [29.2, 82.0], [29.3, 82.0], [29.4, 82.0], [29.5, 82.0], [29.6, 83.0], [29.7, 83.0], [29.8, 83.0], [29.9, 84.0], [30.0, 84.0], [30.1, 84.0], [30.2, 85.0], [30.3, 86.0], [30.4, 86.0], [30.5, 86.0], [30.6, 87.0], [30.7, 88.0], [30.8, 89.0], [30.9, 91.0], [31.0, 92.0], [31.1, 94.0], [31.2, 94.0], [31.3, 95.0], [31.4, 95.0], [31.5, 95.0], [31.6, 96.0], [31.7, 98.0], [31.8, 98.0], [31.9, 99.0], [32.0, 100.0], [32.1, 100.0], [32.2, 101.0], [32.3, 101.0], [32.4, 102.0], [32.5, 102.0], [32.6, 104.0], [32.7, 105.0], [32.8, 107.0], [32.9, 108.0], [33.0, 108.0], [33.1, 109.0], [33.2, 110.0], [33.3, 110.0], [33.4, 111.0], [33.5, 115.0], [33.6, 116.0], [33.7, 116.0], [33.8, 116.0], [33.9, 117.0], [34.0, 117.0], [34.1, 117.0], [34.2, 118.0], [34.3, 118.0], [34.4, 118.0], [34.5, 118.0], [34.6, 119.0], [34.7, 120.0], [34.8, 120.0], [34.9, 121.0], [35.0, 122.0], [35.1, 122.0], [35.2, 123.0], [35.3, 123.0], [35.4, 123.0], [35.5, 124.0], [35.6, 124.0], [35.7, 124.0], [35.8, 124.0], [35.9, 125.0], [36.0, 125.0], [36.1, 125.0], [36.2, 126.0], [36.3, 126.0], [36.4, 126.0], [36.5, 127.0], [36.6, 127.0], [36.7, 127.0], [36.8, 129.0], [36.9, 129.0], [37.0, 130.0], [37.1, 131.0], [37.2, 131.0], [37.3, 131.0], [37.4, 131.0], [37.5, 131.0], [37.6, 131.0], [37.7, 132.0], [37.8, 132.0], [37.9, 132.0], [38.0, 132.0], [38.1, 133.0], [38.2, 133.0], [38.3, 133.0], [38.4, 134.0], [38.5, 134.0], [38.6, 134.0], [38.7, 135.0], [38.8, 135.0], [38.9, 135.0], [39.0, 136.0], [39.1, 136.0], [39.2, 136.0], [39.3, 137.0], [39.4, 137.0], [39.5, 137.0], [39.6, 137.0], [39.7, 138.0], [39.8, 138.0], [39.9, 138.0], [40.0, 138.0], [40.1, 140.0], [40.2, 140.0], [40.3, 140.0], [40.4, 140.0], [40.5, 141.0], [40.6, 141.0], [40.7, 141.0], [40.8, 141.0], [40.9, 142.0], [41.0, 142.0], [41.1, 143.0], [41.2, 143.0], [41.3, 144.0], [41.4, 144.0], [41.5, 145.0], [41.6, 145.0], [41.7, 145.0], [41.8, 145.0], [41.9, 146.0], [42.0, 146.0], [42.1, 146.0], [42.2, 146.0], [42.3, 146.0], [42.4, 147.0], [42.5, 147.0], [42.6, 147.0], [42.7, 147.0], [42.8, 148.0], [42.9, 148.0], [43.0, 148.0], [43.1, 148.0], [43.2, 149.0], [43.3, 149.0], [43.4, 149.0], [43.5, 149.0], [43.6, 149.0], [43.7, 150.0], [43.8, 150.0], [43.9, 150.0], [44.0, 151.0], [44.1, 151.0], [44.2, 152.0], [44.3, 152.0], [44.4, 153.0], [44.5, 153.0], [44.6, 153.0], [44.7, 153.0], [44.8, 154.0], [44.9, 155.0], [45.0, 155.0], [45.1, 156.0], [45.2, 156.0], [45.3, 157.0], [45.4, 157.0], [45.5, 157.0], [45.6, 158.0], [45.7, 159.0], [45.8, 159.0], [45.9, 159.0], [46.0, 160.0], [46.1, 160.0], [46.2, 161.0], [46.3, 161.0], [46.4, 161.0], [46.5, 162.0], [46.6, 162.0], [46.7, 162.0], [46.8, 162.0], [46.9, 162.0], [47.0, 163.0], [47.1, 163.0], [47.2, 163.0], [47.3, 163.0], [47.4, 163.0], [47.5, 163.0], [47.6, 163.0], [47.7, 163.0], [47.8, 163.0], [47.9, 164.0], [48.0, 164.0], [48.1, 164.0], [48.2, 164.0], [48.3, 165.0], [48.4, 165.0], [48.5, 166.0], [48.6, 166.0], [48.7, 166.0], [48.8, 167.0], [48.9, 168.0], [49.0, 168.0], [49.1, 168.0], [49.2, 168.0], [49.3, 168.0], [49.4, 169.0], [49.5, 169.0], [49.6, 169.0], [49.7, 170.0], [49.8, 170.0], [49.9, 170.0], [50.0, 171.0], [50.1, 171.0], [50.2, 171.0], [50.3, 172.0], [50.4, 172.0], [50.5, 172.0], [50.6, 172.0], [50.7, 173.0], [50.8, 173.0], [50.9, 173.0], [51.0, 173.0], [51.1, 173.0], [51.2, 174.0], [51.3, 174.0], [51.4, 174.0], [51.5, 174.0], [51.6, 174.0], [51.7, 175.0], [51.8, 175.0], [51.9, 176.0], [52.0, 176.0], [52.1, 176.0], [52.2, 176.0], [52.3, 176.0], [52.4, 177.0], [52.5, 177.0], [52.6, 177.0], [52.7, 178.0], [52.8, 178.0], [52.9, 178.0], [53.0, 178.0], [53.1, 178.0], [53.2, 179.0], [53.3, 179.0], [53.4, 179.0], [53.5, 179.0], [53.6, 179.0], [53.7, 180.0], [53.8, 180.0], [53.9, 180.0], [54.0, 180.0], [54.1, 181.0], [54.2, 181.0], [54.3, 181.0], [54.4, 182.0], [54.5, 182.0], [54.6, 182.0], [54.7, 183.0], [54.8, 183.0], [54.9, 183.0], [55.0, 183.0], [55.1, 183.0], [55.2, 183.0], [55.3, 183.0], [55.4, 183.0], [55.5, 183.0], [55.6, 184.0], [55.7, 184.0], [55.8, 184.0], [55.9, 184.0], [56.0, 184.0], [56.1, 185.0], [56.2, 185.0], [56.3, 185.0], [56.4, 185.0], [56.5, 185.0], [56.6, 185.0], [56.7, 186.0], [56.8, 186.0], [56.9, 186.0], [57.0, 186.0], [57.1, 187.0], [57.2, 187.0], [57.3, 187.0], [57.4, 187.0], [57.5, 188.0], [57.6, 188.0], [57.7, 188.0], [57.8, 188.0], [57.9, 188.0], [58.0, 188.0], [58.1, 189.0], [58.2, 189.0], [58.3, 189.0], [58.4, 190.0], [58.5, 190.0], [58.6, 190.0], [58.7, 191.0], [58.8, 191.0], [58.9, 191.0], [59.0, 191.0], [59.1, 191.0], [59.2, 191.0], [59.3, 191.0], [59.4, 191.0], [59.5, 191.0], [59.6, 192.0], [59.7, 192.0], [59.8, 192.0], [59.9, 192.0], [60.0, 192.0], [60.1, 192.0], [60.2, 192.0], [60.3, 192.0], [60.4, 193.0], [60.5, 193.0], [60.6, 193.0], [60.7, 193.0], [60.8, 193.0], [60.9, 194.0], [61.0, 194.0], [61.1, 194.0], [61.2, 195.0], [61.3, 195.0], [61.4, 195.0], [61.5, 195.0], [61.6, 195.0], [61.7, 195.0], [61.8, 196.0], [61.9, 196.0], [62.0, 196.0], [62.1, 196.0], [62.2, 196.0], [62.3, 196.0], [62.4, 197.0], [62.5, 197.0], [62.6, 197.0], [62.7, 198.0], [62.8, 198.0], [62.9, 198.0], [63.0, 198.0], [63.1, 199.0], [63.2, 199.0], [63.3, 199.0], [63.4, 200.0], [63.5, 200.0], [63.6, 200.0], [63.7, 200.0], [63.8, 200.0], [63.9, 200.0], [64.0, 200.0], [64.1, 201.0], [64.2, 201.0], [64.3, 201.0], [64.4, 201.0], [64.5, 201.0], [64.6, 201.0], [64.7, 201.0], [64.8, 201.0], [64.9, 202.0], [65.0, 202.0], [65.1, 202.0], [65.2, 203.0], [65.3, 203.0], [65.4, 203.0], [65.5, 203.0], [65.6, 203.0], [65.7, 204.0], [65.8, 204.0], [65.9, 204.0], [66.0, 204.0], [66.1, 204.0], [66.2, 204.0], [66.3, 204.0], [66.4, 204.0], [66.5, 205.0], [66.6, 205.0], [66.7, 205.0], [66.8, 205.0], [66.9, 205.0], [67.0, 206.0], [67.1, 206.0], [67.2, 206.0], [67.3, 206.0], [67.4, 206.0], [67.5, 206.0], [67.6, 207.0], [67.7, 207.0], [67.8, 207.0], [67.9, 208.0], [68.0, 208.0], [68.1, 208.0], [68.2, 209.0], [68.3, 209.0], [68.4, 209.0], [68.5, 210.0], [68.6, 210.0], [68.7, 210.0], [68.8, 210.0], [68.9, 211.0], [69.0, 212.0], [69.1, 213.0], [69.2, 213.0], [69.3, 213.0], [69.4, 214.0], [69.5, 214.0], [69.6, 214.0], [69.7, 215.0], [69.8, 215.0], [69.9, 215.0], [70.0, 215.0], [70.1, 216.0], [70.2, 216.0], [70.3, 216.0], [70.4, 216.0], [70.5, 217.0], [70.6, 217.0], [70.7, 217.0], [70.8, 217.0], [70.9, 217.0], [71.0, 218.0], [71.1, 218.0], [71.2, 218.0], [71.3, 218.0], [71.4, 218.0], [71.5, 218.0], [71.6, 219.0], [71.7, 219.0], [71.8, 219.0], [71.9, 219.0], [72.0, 220.0], [72.1, 220.0], [72.2, 220.0], [72.3, 220.0], [72.4, 220.0], [72.5, 221.0], [72.6, 221.0], [72.7, 221.0], [72.8, 222.0], [72.9, 222.0], [73.0, 223.0], [73.1, 223.0], [73.2, 224.0], [73.3, 224.0], [73.4, 224.0], [73.5, 224.0], [73.6, 224.0], [73.7, 225.0], [73.8, 225.0], [73.9, 225.0], [74.0, 226.0], [74.1, 226.0], [74.2, 226.0], [74.3, 226.0], [74.4, 226.0], [74.5, 227.0], [74.6, 227.0], [74.7, 227.0], [74.8, 227.0], [74.9, 228.0], [75.0, 228.0], [75.1, 228.0], [75.2, 229.0], [75.3, 229.0], [75.4, 229.0], [75.5, 230.0], [75.6, 230.0], [75.7, 230.0], [75.8, 230.0], [75.9, 231.0], [76.0, 231.0], [76.1, 231.0], [76.2, 231.0], [76.3, 231.0], [76.4, 232.0], [76.5, 232.0], [76.6, 232.0], [76.7, 232.0], [76.8, 232.0], [76.9, 233.0], [77.0, 233.0], [77.1, 233.0], [77.2, 233.0], [77.3, 234.0], [77.4, 234.0], [77.5, 234.0], [77.6, 234.0], [77.7, 235.0], [77.8, 235.0], [77.9, 235.0], [78.0, 235.0], [78.1, 235.0], [78.2, 236.0], [78.3, 237.0], [78.4, 237.0], [78.5, 237.0], [78.6, 238.0], [78.7, 238.0], [78.8, 239.0], [78.9, 240.0], [79.0, 241.0], [79.1, 241.0], [79.2, 244.0], [79.3, 245.0], [79.4, 246.0], [79.5, 246.0], [79.6, 247.0], [79.7, 248.0], [79.8, 248.0], [79.9, 249.0], [80.0, 250.0], [80.1, 251.0], [80.2, 251.0], [80.3, 252.0], [80.4, 253.0], [80.5, 254.0], [80.6, 254.0], [80.7, 255.0], [80.8, 255.0], [80.9, 255.0], [81.0, 256.0], [81.1, 256.0], [81.2, 257.0], [81.3, 257.0], [81.4, 258.0], [81.5, 258.0], [81.6, 259.0], [81.7, 259.0], [81.8, 260.0], [81.9, 260.0], [82.0, 261.0], [82.1, 262.0], [82.2, 262.0], [82.3, 263.0], [82.4, 263.0], [82.5, 264.0], [82.6, 266.0], [82.7, 267.0], [82.8, 269.0], [82.9, 269.0], [83.0, 270.0], [83.1, 271.0], [83.2, 272.0], [83.3, 272.0], [83.4, 273.0], [83.5, 273.0], [83.6, 274.0], [83.7, 275.0], [83.8, 276.0], [83.9, 276.0], [84.0, 277.0], [84.1, 277.0], [84.2, 278.0], [84.3, 279.0], [84.4, 279.0], [84.5, 280.0], [84.6, 281.0], [84.7, 282.0], [84.8, 283.0], [84.9, 283.0], [85.0, 283.0], [85.1, 283.0], [85.2, 284.0], [85.3, 284.0], [85.4, 285.0], [85.5, 285.0], [85.6, 285.0], [85.7, 285.0], [85.8, 286.0], [85.9, 286.0], [86.0, 287.0], [86.1, 287.0], [86.2, 288.0], [86.3, 290.0], [86.4, 290.0], [86.5, 293.0], [86.6, 293.0], [86.7, 294.0], [86.8, 295.0], [86.9, 296.0], [87.0, 298.0], [87.1, 299.0], [87.2, 299.0], [87.3, 301.0], [87.4, 303.0], [87.5, 303.0], [87.6, 304.0], [87.7, 304.0], [87.8, 304.0], [87.9, 305.0], [88.0, 306.0], [88.1, 306.0], [88.2, 307.0], [88.3, 307.0], [88.4, 308.0], [88.5, 309.0], [88.6, 309.0], [88.7, 309.0], [88.8, 309.0], [88.9, 309.0], [89.0, 310.0], [89.1, 311.0], [89.2, 311.0], [89.3, 311.0], [89.4, 311.0], [89.5, 312.0], [89.6, 312.0], [89.7, 312.0], [89.8, 312.0], [89.9, 313.0], [90.0, 313.0], [90.1, 314.0], [90.2, 314.0], [90.3, 315.0], [90.4, 316.0], [90.5, 317.0], [90.6, 318.0], [90.7, 320.0], [90.8, 321.0], [90.9, 322.0], [91.0, 324.0], [91.1, 327.0], [91.2, 328.0], [91.3, 328.0], [91.4, 328.0], [91.5, 329.0], [91.6, 330.0], [91.7, 331.0], [91.8, 332.0], [91.9, 332.0], [92.0, 334.0], [92.1, 335.0], [92.2, 336.0], [92.3, 337.0], [92.4, 337.0], [92.5, 338.0], [92.6, 338.0], [92.7, 338.0], [92.8, 339.0], [92.9, 339.0], [93.0, 339.0], [93.1, 340.0], [93.2, 340.0], [93.3, 340.0], [93.4, 340.0], [93.5, 341.0], [93.6, 342.0], [93.7, 343.0], [93.8, 343.0], [93.9, 344.0], [94.0, 345.0], [94.1, 347.0], [94.2, 348.0], [94.3, 349.0], [94.4, 351.0], [94.5, 352.0], [94.6, 352.0], [94.7, 354.0], [94.8, 355.0], [94.9, 356.0], [95.0, 358.0], [95.1, 358.0], [95.2, 359.0], [95.3, 366.0], [95.4, 368.0], [95.5, 371.0], [95.6, 375.0], [95.7, 376.0], [95.8, 379.0], [95.9, 382.0], [96.0, 390.0], [96.1, 392.0], [96.2, 393.0], [96.3, 393.0], [96.4, 394.0], [96.5, 395.0], [96.6, 397.0], [96.7, 400.0], [96.8, 401.0], [96.9, 418.0], [97.0, 419.0], [97.1, 420.0], [97.2, 425.0], [97.3, 427.0], [97.4, 429.0], [97.5, 430.0], [97.6, 431.0], [97.7, 436.0], [97.8, 447.0], [97.9, 452.0], [98.0, 461.0], [98.1, 462.0], [98.2, 464.0], [98.3, 469.0], [98.4, 496.0], [98.5, 511.0], [98.6, 674.0], [98.7, 678.0], [98.8, 680.0], [98.9, 684.0], [99.0, 686.0], [99.1, 686.0], [99.2, 690.0], [99.3, 691.0], [99.4, 694.0], [99.5, 696.0], [99.6, 698.0], [99.7, 700.0], [99.8, 701.0], [99.9, 704.0]], "isOverall": false, "label": "Redis查询HTTP请求", "isController": false}], "supportsControllersDiscrimination": true, "maxX": 100.0, "title": "Response Time Percentiles"}},
        getOptions: function() {
            return {
                series: {
                    points: { show: false }
                },
                legend: {
                    noColumns: 2,
                    show: true,
                    container: '#legendResponseTimePercentiles'
                },
                xaxis: {
                    tickDecimals: 1,
                    axisLabel: "Percentiles",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                yaxis: {
                    axisLabel: "Percentile value in ms",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20
                },
                grid: {
                    hoverable: true // IMPORTANT! this is needed for tooltip to
                                    // work
                },
                tooltip: true,
                tooltipOpts: {
                    content: "%s : %x.2 percentile was %y ms"
                },
                selection: { mode: "xy" },
            };
        },
        createGraph: function() {
            var data = this.data;
            var dataset = prepareData(data.result.series, $("#choicesResponseTimePercentiles"));
            var options = this.getOptions();
            prepareOptions(options, data);
            $.plot($("#flotResponseTimesPercentiles"), dataset, options);
            // setup overview
            $.plot($("#overviewResponseTimesPercentiles"), dataset, prepareOverviewOptions(options));
        }
};

/**
 * @param elementId Id of element where we display message
 */
function setEmptyGraph(elementId) {
    $(function() {
        $(elementId).text("No graph series with filter="+seriesFilter);
    });
}

// Response times percentiles
function refreshResponseTimePercentiles() {
    var infos = responseTimePercentilesInfos;
    prepareSeries(infos.data);
    if(infos.data.result.series.length == 0) {
        setEmptyGraph("#bodyResponseTimePercentiles");
        return;
    }
    if (isGraph($("#flotResponseTimesPercentiles"))){
        infos.createGraph();
    } else {
        var choiceContainer = $("#choicesResponseTimePercentiles");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        setGraphZoomable("#flotResponseTimesPercentiles", "#overviewResponseTimesPercentiles");
        $('#bodyResponseTimePercentiles .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
}

var responseTimeDistributionInfos = {
        data: {"result": {"minY": 2.0, "minX": 0.0, "maxY": 960.0, "series": [{"data": [[0.0, 960.0], [300.0, 284.0], [600.0, 34.0], [700.0, 10.0], [100.0, 941.0], [200.0, 715.0], [400.0, 54.0], [500.0, 2.0]], "isOverall": false, "label": "Redis查询HTTP请求", "isController": false}], "supportsControllersDiscrimination": true, "granularity": 100, "maxX": 700.0, "title": "Response Time Distribution"}},
        getOptions: function() {
            var granularity = this.data.result.granularity;
            return {
                legend: {
                    noColumns: 2,
                    show: true,
                    container: '#legendResponseTimeDistribution'
                },
                xaxis:{
                    axisLabel: "Response times in ms",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                yaxis: {
                    axisLabel: "Number of responses",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                bars : {
                    show: true,
                    barWidth: this.data.result.granularity
                },
                grid: {
                    hoverable: true // IMPORTANT! this is needed for tooltip to
                                    // work
                },
                tooltip: true,
                tooltipOpts: {
                    content: function(label, xval, yval, flotItem){
                        return yval + " responses for " + label + " were between " + xval + " and " + (xval + granularity) + " ms";
                    }
                }
            };
        },
        createGraph: function() {
            var data = this.data;
            var options = this.getOptions();
            prepareOptions(options, data);
            $.plot($("#flotResponseTimeDistribution"), prepareData(data.result.series, $("#choicesResponseTimeDistribution")), options);
        }

};

// Response time distribution
function refreshResponseTimeDistribution() {
    var infos = responseTimeDistributionInfos;
    prepareSeries(infos.data);
    if(infos.data.result.series.length == 0) {
        setEmptyGraph("#bodyResponseTimeDistribution");
        return;
    }
    if (isGraph($("#flotResponseTimeDistribution"))){
        infos.createGraph();
    }else{
        var choiceContainer = $("#choicesResponseTimeDistribution");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        $('#footerResponseTimeDistribution .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
};


var syntheticResponseTimeDistributionInfos = {
        data: {"result": {"minY": 46.0, "minX": 0.0, "ticks": [[0, "Requests having \nresponse time <= 500ms"], [1, "Requests having \nresponse time > 500ms and <= 1,500ms"], [2, "Requests having \nresponse time > 1,500ms"], [3, "Requests in error"]], "maxY": 2954.0, "series": [{"data": [[0.0, 2954.0]], "color": "#9ACD32", "isOverall": false, "label": "Requests having \nresponse time <= 500ms", "isController": false}, {"data": [[1.0, 46.0]], "color": "yellow", "isOverall": false, "label": "Requests having \nresponse time > 500ms and <= 1,500ms", "isController": false}, {"data": [], "color": "orange", "isOverall": false, "label": "Requests having \nresponse time > 1,500ms", "isController": false}, {"data": [], "color": "#FF6347", "isOverall": false, "label": "Requests in error", "isController": false}], "supportsControllersDiscrimination": false, "maxX": 1.0, "title": "Synthetic Response Times Distribution"}},
        getOptions: function() {
            return {
                legend: {
                    noColumns: 2,
                    show: true,
                    container: '#legendSyntheticResponseTimeDistribution'
                },
                xaxis:{
                    axisLabel: "Response times ranges",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                    tickLength:0,
                    min:-0.5,
                    max:3.5
                },
                yaxis: {
                    axisLabel: "Number of responses",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                bars : {
                    show: true,
                    align: "center",
                    barWidth: 0.25,
                    fill:.75
                },
                grid: {
                    hoverable: true // IMPORTANT! this is needed for tooltip to
                                    // work
                },
                tooltip: true,
                tooltipOpts: {
                    content: function(label, xval, yval, flotItem){
                        return yval + " " + label;
                    }
                }
            };
        },
        createGraph: function() {
            var data = this.data;
            var options = this.getOptions();
            prepareOptions(options, data);
            options.xaxis.ticks = data.result.ticks;
            $.plot($("#flotSyntheticResponseTimeDistribution"), prepareData(data.result.series, $("#choicesSyntheticResponseTimeDistribution")), options);
        }

};

// Response time distribution
function refreshSyntheticResponseTimeDistribution() {
    var infos = syntheticResponseTimeDistributionInfos;
    prepareSeries(infos.data, true);
    if (isGraph($("#flotSyntheticResponseTimeDistribution"))){
        infos.createGraph();
    }else{
        var choiceContainer = $("#choicesSyntheticResponseTimeDistribution");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        $('#footerSyntheticResponseTimeDistribution .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
};

var activeThreadsOverTimeInfos = {
        data: {"result": {"minY": 501.3933333333326, "minX": 1.71041364E12, "maxY": 501.3933333333326, "series": [{"data": [[1.71041364E12, 501.3933333333326]], "isOverall": false, "label": "线程组3", "isController": false}], "supportsControllersDiscrimination": false, "granularity": 60000, "maxX": 1.71041364E12, "title": "Active Threads Over Time"}},
        getOptions: function() {
            return {
                series: {
                    stack: true,
                    lines: {
                        show: true,
                        fill: true
                    },
                    points: {
                        show: true
                    }
                },
                xaxis: {
                    mode: "time",
                    timeformat: getTimeFormat(this.data.result.granularity),
                    axisLabel: getElapsedTimeLabel(this.data.result.granularity),
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                yaxis: {
                    axisLabel: "Number of active threads",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20
                },
                legend: {
                    noColumns: 6,
                    show: true,
                    container: '#legendActiveThreadsOverTime'
                },
                grid: {
                    hoverable: true // IMPORTANT! this is needed for tooltip to
                                    // work
                },
                selection: {
                    mode: 'xy'
                },
                tooltip: true,
                tooltipOpts: {
                    content: "%s : At %x there were %y active threads"
                }
            };
        },
        createGraph: function() {
            var data = this.data;
            var dataset = prepareData(data.result.series, $("#choicesActiveThreadsOverTime"));
            var options = this.getOptions();
            prepareOptions(options, data);
            $.plot($("#flotActiveThreadsOverTime"), dataset, options);
            // setup overview
            $.plot($("#overviewActiveThreadsOverTime"), dataset, prepareOverviewOptions(options));
        }
};

// Active Threads Over Time
function refreshActiveThreadsOverTime(fixTimestamps) {
    var infos = activeThreadsOverTimeInfos;
    prepareSeries(infos.data);
    if(fixTimestamps) {
        fixTimeStamps(infos.data.result.series, 28800000);
    }
    if(isGraph($("#flotActiveThreadsOverTime"))) {
        infos.createGraph();
    }else{
        var choiceContainer = $("#choicesActiveThreadsOverTime");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        setGraphZoomable("#flotActiveThreadsOverTime", "#overviewActiveThreadsOverTime");
        $('#footerActiveThreadsOverTime .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
};

var timeVsThreadsInfos = {
        data: {"result": {"minY": 5.0, "minX": 10.0, "maxY": 694.0, "series": [{"data": [[10.0, 45.0], [13.0, 53.0], [16.0, 31.0], [18.0, 23.0], [19.0, 36.0], [22.0, 48.0], [23.0, 39.0], [30.0, 36.0], [33.0, 49.333333333333336], [32.0, 44.0], [37.0, 51.0], [39.0, 41.666666666666664], [41.0, 48.0], [40.0, 56.0], [47.0, 39.5], [46.0, 45.0], [48.0, 38.5], [53.0, 53.0], [52.0, 32.0], [55.0, 44.666666666666664], [57.0, 41.0], [59.0, 54.0], [62.0, 55.0], [67.0, 28.0], [66.0, 53.0], [64.0, 54.0], [71.0, 35.5], [74.0, 51.0], [75.0, 55.0], [72.0, 54.0], [76.0, 42.5], [83.0, 57.0], [82.0, 26.0], [81.0, 69.0], [80.0, 68.0], [84.0, 36.0], [85.0, 60.333333333333336], [90.0, 58.666666666666664], [89.0, 42.0], [92.0, 46.527272727272724], [97.0, 60.6], [96.0, 56.666666666666664], [101.0, 54.25], [105.0, 47.25], [109.0, 33.0], [115.0, 5.0], [114.0, 84.0], [112.0, 52.0], [117.0, 6.0], [116.0, 53.57142857142858], [121.0, 47.83333333333333], [125.0, 75.0], [124.0, 52.0], [133.0, 13.0], [135.0, 14.0], [134.0, 38.0], [132.0, 40.0], [131.0, 68.0], [130.0, 45.166666666666664], [138.0, 42.666666666666664], [143.0, 53.0], [140.0, 44.5], [139.0, 31.0], [137.0, 46.333333333333336], [145.0, 16.0], [146.0, 17.833333333333336], [149.0, 59.0], [144.0, 56.333333333333336], [159.0, 35.0], [158.0, 29.0], [155.0, 62.666666666666664], [152.0, 60.333333333333336], [167.0, 48.0], [165.0, 34.0], [164.0, 65.0], [163.0, 66.6], [160.0, 65.0], [175.0, 44.0], [173.0, 41.0], [171.0, 55.0], [168.0, 33.0], [183.0, 50.0], [179.0, 57.25], [185.0, 34.5], [187.0, 35.0], [190.0, 35.0], [191.0, 48.55555555555555], [186.0, 41.0], [196.0, 40.0], [199.0, 44.5], [197.0, 63.0], [194.0, 54.5], [206.0, 55.333333333333336], [205.0, 54.0], [203.0, 54.0], [214.0, 71.5], [212.0, 67.0], [210.0, 45.0], [209.0, 56.0], [222.0, 53.25], [219.0, 78.0], [218.0, 53.666666666666664], [230.0, 43.0], [229.0, 41.0], [228.0, 69.0], [227.0, 71.5], [225.0, 79.0], [224.0, 62.333333333333336], [238.0, 65.0], [237.0, 57.5], [236.0, 52.8], [233.0, 45.0], [247.0, 69.75], [245.0, 73.0], [242.0, 82.0], [241.0, 52.333333333333336], [255.0, 77.5], [254.0, 69.0], [252.0, 52.333333333333336], [249.0, 69.0], [271.0, 76.0], [270.0, 56.333333333333336], [265.0, 68.0], [264.0, 78.75], [261.0, 68.75], [259.0, 54.0], [256.0, 71.0], [287.0, 66.0], [285.0, 64.0], [284.0, 72.5], [281.0, 66.66666666666667], [279.0, 67.66666666666667], [278.0, 72.75], [274.0, 68.0], [273.0, 76.0], [300.0, 57.0], [295.0, 83.5], [288.0, 77.0], [291.0, 65.0], [289.0, 71.0], [299.0, 84.0], [302.0, 43.0], [301.0, 73.69230769230771], [303.0, 82.5], [296.0, 75.0], [294.0, 76.0], [293.0, 72.66666666666667], [292.0, 70.5], [317.0, 102.0], [305.0, 66.71428571428572], [308.0, 80.5], [310.0, 66.0], [309.0, 66.0], [311.0, 78.0], [312.0, 76.75], [313.0, 92.5], [314.0, 71.0], [319.0, 63.5], [318.0, 70.66666666666667], [316.0, 72.0], [307.0, 75.0], [321.0, 86.54545454545455], [320.0, 78.25], [322.0, 89.5], [323.0, 101.5], [327.0, 109.66666666666667], [325.0, 71.5], [324.0, 89.16666666666667], [335.0, 74.33333333333334], [329.0, 71.0], [331.0, 70.0], [330.0, 69.0], [334.0, 108.5], [333.0, 90.25], [332.0, 74.25], [339.0, 69.33333333333333], [337.0, 67.0], [336.0, 100.0], [338.0, 87.42857142857143], [341.0, 67.66666666666667], [342.0, 68.0], [343.0, 60.99999999999999], [347.0, 101.25], [346.0, 66.33333333333333], [345.0, 67.5], [344.0, 68.0], [350.0, 98.5], [351.0, 68.75], [349.0, 62.66666666666667], [348.0, 88.33333333333333], [355.0, 92.25], [353.0, 81.875], [352.0, 95.25], [358.0, 64.5], [357.0, 88.66666666666667], [356.0, 84.6], [354.0, 66.75], [367.0, 63.55555555555556], [361.0, 65.0], [363.0, 64.33333333333333], [362.0, 61.75], [366.0, 62.0], [364.0, 63.25], [382.0, 124.5], [383.0, 93.44999999999999], [381.0, 94.57142857142858], [380.0, 89.77777777777777], [378.0, 75.5], [379.0, 73.33333333333333], [377.0, 58.0], [375.0, 60.5], [368.0, 61.25], [371.0, 59.666666666666664], [370.0, 60.0], [374.0, 61.0], [373.0, 60.333333333333336], [387.0, 113.38461538461539], [385.0, 113.5], [386.0, 109.0], [384.0, 110.73333333333332], [391.0, 55.333333333333336], [390.0, 57.0], [389.0, 102.0], [388.0, 101.00000000000001], [395.0, 54.83333333333333], [394.0, 54.0], [392.0, 56.5], [399.0, 87.5], [398.0, 53.5], [396.0, 55.0], [414.0, 51.666666666666664], [401.0, 70.6], [404.0, 103.7], [405.0, 53.5], [403.0, 84.0], [402.0, 51.5], [412.0, 52.0], [409.0, 74.625], [408.0, 92.25], [407.0, 67.25], [400.0, 54.0], [406.0, 52.25], [410.0, 142.0], [411.0, 53.0], [415.0, 57.666666666666664], [418.0, 72.0], [422.0, 115.0], [428.0, 49.666666666666664], [427.0, 49.57142857142858], [424.0, 49.0], [423.0, 50.5], [421.0, 49.75], [420.0, 51.0], [419.0, 51.0], [446.0, 46.333333333333336], [447.0, 45.6], [444.0, 46.6], [441.0, 47.5], [439.0, 47.666666666666664], [438.0, 48.16666666666667], [437.0, 48.0], [435.0, 46.5], [434.0, 49.2], [461.0, 43.0], [463.0, 42.25], [460.0, 42.0], [451.0, 47.0], [450.0, 44.714285714285715], [459.0, 43.0], [458.0, 43.0], [457.0, 44.0], [455.0, 44.0], [454.0, 44.0], [453.0, 45.0], [452.0, 44.5], [479.0, 94.0], [478.0, 80.0], [475.0, 65.75], [473.0, 41.0], [471.0, 81.57142857142857], [470.0, 100.0], [469.0, 40.0], [468.0, 41.5], [467.0, 43.0], [465.0, 42.5], [492.0, 74.33333333333334], [490.0, 133.0], [489.0, 39.333333333333336], [488.0, 38.0], [480.0, 39.0], [510.0, 86.5], [509.0, 79.5], [507.0, 79.75], [504.0, 99.0], [502.0, 38.0], [499.0, 37.0], [496.0, 86.5], [532.0, 136.0], [542.0, 104.6], [528.0, 127.0], [539.0, 130.5], [536.0, 85.0], [519.0, 99.33333333333333], [515.0, 101.0], [513.0, 92.4], [512.0, 80.0], [526.0, 31.0], [525.0, 127.0], [524.0, 56.5], [535.0, 154.0], [534.0, 104.66666666666666], [533.0, 30.0], [530.0, 64.33333333333333], [529.0, 30.0], [563.0, 138.0], [574.0, 125.0], [573.0, 136.0], [570.0, 127.5], [551.0, 135.0], [547.0, 72.5], [546.0, 136.5], [545.0, 82.75], [566.0, 141.5], [565.0, 124.0], [564.0, 137.0], [561.0, 143.0], [558.0, 144.0], [555.0, 124.5], [554.0, 96.0], [552.0, 129.5], [606.0, 138.0], [607.0, 132.66666666666666], [593.0, 136.4], [595.0, 140.0], [594.0, 137.25], [605.0, 145.0], [604.0, 119.0], [602.0, 165.66666666666666], [601.0, 144.66666666666666], [600.0, 134.0], [583.0, 121.66666666666666], [579.0, 126.0], [578.0, 135.0], [577.0, 137.0], [576.0, 141.66666666666666], [591.0, 139.5], [589.0, 132.2], [585.0, 150.0], [584.0, 132.28571428571428], [597.0, 129.0], [596.0, 131.33333333333334], [633.0, 148.0], [620.0, 172.0], [619.0, 145.33333333333334], [618.0, 151.0], [617.0, 140.4], [616.0, 163.0], [621.0, 157.33333333333334], [623.0, 173.0], [622.0, 135.0], [626.0, 153.4], [627.0, 175.0], [624.0, 204.0], [625.0, 147.4], [637.0, 123.0], [634.0, 193.0], [635.0, 171.0], [628.0, 147.0], [629.0, 136.0], [632.0, 62.0], [615.0, 139.0], [613.0, 132.33333333333334], [610.0, 138.25], [608.0, 122.0], [614.0, 133.0], [667.0, 174.0], [660.0, 219.0], [671.0, 206.85714285714286], [662.0, 171.5], [661.0, 163.0], [664.0, 193.0], [652.0, 134.0], [644.0, 150.0], [663.0, 220.0], [665.0, 180.8181818181818], [666.0, 208.5], [669.0, 197.5], [670.0, 196.875], [673.0, 178.66666666666669], [672.0, 203.57142857142856], [686.0, 210.5], [684.0, 214.875], [683.0, 237.66666666666666], [685.0, 210.33333333333334], [674.0, 228.0], [676.0, 207.66666666666666], [679.0, 207.8], [696.0, 198.0], [688.0, 206.5], [695.0, 140.5], [700.0, 180.0], [701.0, 260.0], [702.0, 199.2], [698.0, 195.0], [699.0, 257.0], [697.0, 210.33333333333331], [678.0, 207.33333333333334], [677.0, 212.25], [680.0, 253.5], [682.0, 242.5], [716.0, 227.0], [704.0, 162.0], [707.0, 195.0], [709.0, 191.5], [710.0, 149.0], [711.0, 260.5], [720.0, 224.5], [734.0, 215.0], [733.0, 208.66666666666666], [728.0, 201.33333333333334], [730.0, 201.5], [732.0, 185.85714285714286], [723.0, 201.66666666666669], [724.0, 66.0], [726.0, 173.5], [725.0, 187.33333333333334], [727.0, 225.0], [722.0, 155.25], [712.0, 253.2], [713.0, 214.0], [715.0, 190.0], [718.0, 212.625], [719.0, 82.0], [742.0, 118.0], [748.0, 162.0], [736.0, 176.0], [737.0, 228.5], [745.0, 141.49999999999997], [746.0, 146.99999999999994], [752.0, 157.3], [765.0, 167.66666666666666], [766.0, 172.0], [762.0, 176.0], [764.0, 176.0], [760.0, 147.66666666666666], [761.0, 169.28571428571428], [753.0, 158.08333333333334], [754.0, 166.33333333333334], [755.0, 169.44444444444446], [756.0, 164.66666666666666], [757.0, 169.0909090909091], [758.0, 175.5], [759.0, 174.0], [747.0, 150.45454545454544], [749.0, 150.4], [750.0, 148.92307692307693], [751.0, 164.0], [773.0, 172.71428571428572], [769.0, 351.55555555555554], [768.0, 194.0], [782.0, 195.0], [783.0, 175.66666666666666], [770.0, 163.71428571428572], [771.0, 180.0], [772.0, 170.71428571428572], [775.0, 298.75], [792.0, 259.0], [794.0, 176.33333333333334], [796.0, 183.0], [797.0, 431.0], [798.0, 178.0], [786.0, 173.0], [787.0, 177.5], [788.0, 179.0], [790.0, 173.5], [791.0, 227.45454545454547], [776.0, 171.0], [777.0, 191.5], [807.0, 193.0], [801.0, 184.5], [800.0, 191.0], [814.0, 179.8], [802.0, 185.0], [806.0, 175.2], [805.0, 174.0], [808.0, 166.0], [816.0, 691.5], [830.0, 347.0], [831.0, 173.5], [827.0, 173.75], [829.0, 185.0], [824.0, 686.0], [825.0, 185.0], [818.0, 680.0], [819.0, 194.0], [820.0, 306.0], [822.0, 350.0], [823.0, 324.3636363636364], [810.0, 175.0], [811.0, 690.5], [813.0, 686.0], [838.0, 519.0], [833.0, 258.57142857142856], [832.0, 187.5], [847.0, 179.0], [845.0, 694.0], [846.0, 183.0], [834.0, 523.6666666666666], [836.0, 204.0], [837.0, 326.0], [839.0, 186.0], [857.0, 182.66666666666666], [858.0, 198.0], [859.0, 252.125], [860.0, 193.5], [862.0, 201.0], [863.0, 690.0], [861.0, 173.0], [848.0, 179.0], [849.0, 515.6666666666666], [850.0, 266.0], [852.0, 440.5], [854.0, 356.33333333333337], [855.0, 177.25], [842.0, 439.0], [843.0, 192.0], [877.0, 204.5], [865.0, 323.75], [866.0, 452.5], [869.0, 202.5], [871.0, 176.5], [880.0, 176.5], [881.0, 674.0], [894.0, 169.0], [895.0, 210.0], [892.0, 192.75], [891.0, 195.0], [889.0, 193.0], [893.0, 365.83333333333337], [883.0, 202.0], [885.0, 290.4], [873.0, 184.25], [875.0, 191.5], [876.0, 204.0], [879.0, 183.0], [925.0, 204.0], [916.0, 177.5], [926.0, 193.0], [912.0, 196.33333333333334], [914.0, 198.0], [913.0, 150.33333333333334], [923.0, 197.5], [922.0, 224.0], [920.0, 206.0], [901.0, 172.0], [900.0, 267.33333333333337], [898.0, 189.0], [899.0, 204.0], [896.0, 199.75], [897.0, 197.5], [911.0, 211.66666666666666], [909.0, 200.5], [906.0, 198.0], [907.0, 199.0], [908.0, 235.0], [904.0, 176.0], [905.0, 176.0], [919.0, 180.0], [918.0, 190.0], [917.0, 184.8], [967.0, 207.0], [966.0, 205.0], [965.0, 227.0], [1020.0, 209.66666666666666], [1022.0, 202.11111111111111], [1023.0, 215.66666666666666], [1021.0, 196.0], [1019.0, 200.27272727272728], [1018.0, 145.0], [1017.0, 206.33333333333334], [1015.0, 198.0], [1013.0, 194.66666666666666], [1016.0, 195.0], [1078.0, 349.5], [1062.0, 210.88888888888889], [1047.0, 289.27272727272725], [1046.0, 212.16666666666666], [1045.0, 220.0], [1044.0, 211.0], [1043.0, 197.9], [1042.0, 213.0], [1041.0, 213.66666666666666], [1040.0, 203.0], [1048.0, 186.5], [1050.0, 197.5], [1049.0, 199.75], [1052.0, 213.22222222222223], [1051.0, 213.6153846153846], [1055.0, 205.77777777777777], [1039.0, 200.5], [1038.0, 209.0], [1036.0, 221.33333333333334], [1034.0, 225.5], [1033.0, 168.5], [1031.0, 189.0], [1029.0, 214.5], [1028.0, 237.0], [1027.0, 221.25], [1026.0, 219.4], [1025.0, 188.0], [1024.0, 187.5], [1054.0, 214.99999999999997], [1053.0, 219.00000000000003], [1072.0, 258.0], [1074.0, 359.0], [1075.0, 336.5], [1077.0, 382.0], [1082.0, 452.0], [1084.0, 240.33333333333334], [1085.0, 213.0], [1083.0, 232.33333333333334], [1086.0, 288.4], [1087.0, 272.33333333333337], [1056.0, 202.49999999999997], [1058.0, 213.54545454545456], [1057.0, 202.1], [1076.0, 418.0], [1073.0, 257.0], [1059.0, 267.2857142857143], [1061.0, 197.33333333333331], [1060.0, 208.71428571428572], [1066.0, 375.0], [1065.0, 218.33333333333334], [1064.0, 224.36363636363637], [1063.0, 214.6], [1068.0, 293.6666666666667], [1067.0, 375.0], [1069.0, 299.5], [1070.0, 350.5], [1097.0, 369.0], [1111.0, 222.54545454545456], [1088.0, 250.6], [1090.0, 230.6], [1091.0, 196.0], [1089.0, 227.375], [1096.0, 253.54545454545456], [1095.0, 263.0], [1094.0, 228.5], [1093.0, 253.88888888888889], [1117.0, 269.4285714285715], [1116.0, 235.16666666666666], [1115.0, 282.12], [1118.0, 322.1764705882353], [1119.0, 295.03125], [1113.0, 270.32], [1112.0, 265.8918918918919], [1114.0, 270.2857142857143], [1098.0, 202.91666666666666], [1100.0, 231.0], [1099.0, 202.1], [1101.0, 260.2], [1102.0, 263.64705882352945], [1103.0, 225.30769230769232], [1137.0, 329.16666666666663], [1138.0, 327.5714285714286], [1136.0, 265.6], [1120.0, 350.81250000000006], [1121.0, 320.8], [1122.0, 363.79999999999995], [1123.0, 325.0], [1125.0, 316.14285714285717], [1126.0, 320.090909090909], [1124.0, 330.23255813953494], [1129.0, 359.66666666666663], [1128.0, 373.6], [1127.0, 313.4], [1131.0, 359.53846153846155], [1130.0, 345.4], [1134.0, 244.25], [1135.0, 165.0], [1133.0, 318.2666666666667], [1132.0, 325.8333333333333], [1106.0, 242.40000000000003], [1104.0, 224.81249999999997], [1105.0, 274.53846153846155], [1109.0, 224.16666666666666], [1107.0, 229.375], [1108.0, 175.6], [1110.0, 206.2941176470588]], "isOverall": false, "label": "Redis查询HTTP请求", "isController": false}, {"data": [[706.9589999999997, 174.44599999999994]], "isOverall": false, "label": "Redis查询HTTP请求-Aggregated", "isController": false}], "supportsControllersDiscrimination": true, "maxX": 1138.0, "title": "Time VS Threads"}},
        getOptions: function() {
            return {
                series: {
                    lines: {
                        show: true
                    },
                    points: {
                        show: true
                    }
                },
                xaxis: {
                    axisLabel: "Number of active threads",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                yaxis: {
                    axisLabel: "Average response times in ms",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20
                },
                legend: { noColumns: 2,show: true, container: '#legendTimeVsThreads' },
                selection: {
                    mode: 'xy'
                },
                grid: {
                    hoverable: true // IMPORTANT! this is needed for tooltip to work
                },
                tooltip: true,
                tooltipOpts: {
                    content: "%s: At %x.2 active threads, Average response time was %y.2 ms"
                }
            };
        },
        createGraph: function() {
            var data = this.data;
            var dataset = prepareData(data.result.series, $("#choicesTimeVsThreads"));
            var options = this.getOptions();
            prepareOptions(options, data);
            $.plot($("#flotTimesVsThreads"), dataset, options);
            // setup overview
            $.plot($("#overviewTimesVsThreads"), dataset, prepareOverviewOptions(options));
        }
};

// Time vs threads
function refreshTimeVsThreads(){
    var infos = timeVsThreadsInfos;
    prepareSeries(infos.data);
    if(infos.data.result.series.length == 0) {
        setEmptyGraph("#bodyTimeVsThreads");
        return;
    }
    if(isGraph($("#flotTimesVsThreads"))){
        infos.createGraph();
    }else{
        var choiceContainer = $("#choicesTimeVsThreads");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        setGraphZoomable("#flotTimesVsThreads", "#overviewTimesVsThreads");
        $('#footerTimeVsThreads .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
};

var bytesThroughputOverTimeInfos = {
        data : {"result": {"minY": 16450.0, "minX": 1.71041364E12, "maxY": 17950.0, "series": [{"data": [[1.71041364E12, 16450.0]], "isOverall": false, "label": "Bytes received per second", "isController": false}, {"data": [[1.71041364E12, 17950.0]], "isOverall": false, "label": "Bytes sent per second", "isController": false}], "supportsControllersDiscrimination": false, "granularity": 60000, "maxX": 1.71041364E12, "title": "Bytes Throughput Over Time"}},
        getOptions : function(){
            return {
                series: {
                    lines: {
                        show: true
                    },
                    points: {
                        show: true
                    }
                },
                xaxis: {
                    mode: "time",
                    timeformat: getTimeFormat(this.data.result.granularity),
                    axisLabel: getElapsedTimeLabel(this.data.result.granularity) ,
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                yaxis: {
                    axisLabel: "Bytes / sec",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                legend: {
                    noColumns: 2,
                    show: true,
                    container: '#legendBytesThroughputOverTime'
                },
                selection: {
                    mode: "xy"
                },
                grid: {
                    hoverable: true // IMPORTANT! this is needed for tooltip to
                                    // work
                },
                tooltip: true,
                tooltipOpts: {
                    content: "%s at %x was %y"
                }
            };
        },
        createGraph : function() {
            var data = this.data;
            var dataset = prepareData(data.result.series, $("#choicesBytesThroughputOverTime"));
            var options = this.getOptions();
            prepareOptions(options, data);
            $.plot($("#flotBytesThroughputOverTime"), dataset, options);
            // setup overview
            $.plot($("#overviewBytesThroughputOverTime"), dataset, prepareOverviewOptions(options));
        }
};

// Bytes throughput Over Time
function refreshBytesThroughputOverTime(fixTimestamps) {
    var infos = bytesThroughputOverTimeInfos;
    prepareSeries(infos.data);
    if(fixTimestamps) {
        fixTimeStamps(infos.data.result.series, 28800000);
    }
    if(isGraph($("#flotBytesThroughputOverTime"))){
        infos.createGraph();
    }else{
        var choiceContainer = $("#choicesBytesThroughputOverTime");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        setGraphZoomable("#flotBytesThroughputOverTime", "#overviewBytesThroughputOverTime");
        $('#footerBytesThroughputOverTime .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
}

var responseTimesOverTimeInfos = {
        data: {"result": {"minY": 174.44599999999994, "minX": 1.71041364E12, "maxY": 174.44599999999994, "series": [{"data": [[1.71041364E12, 174.44599999999994]], "isOverall": false, "label": "Redis查询HTTP请求", "isController": false}], "supportsControllersDiscrimination": true, "granularity": 60000, "maxX": 1.71041364E12, "title": "Response Time Over Time"}},
        getOptions: function(){
            return {
                series: {
                    lines: {
                        show: true
                    },
                    points: {
                        show: true
                    }
                },
                xaxis: {
                    mode: "time",
                    timeformat: getTimeFormat(this.data.result.granularity),
                    axisLabel: getElapsedTimeLabel(this.data.result.granularity),
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                yaxis: {
                    axisLabel: "Average response time in ms",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                legend: {
                    noColumns: 2,
                    show: true,
                    container: '#legendResponseTimesOverTime'
                },
                selection: {
                    mode: 'xy'
                },
                grid: {
                    hoverable: true // IMPORTANT! this is needed for tooltip to
                                    // work
                },
                tooltip: true,
                tooltipOpts: {
                    content: "%s : at %x Average response time was %y ms"
                }
            };
        },
        createGraph: function() {
            var data = this.data;
            var dataset = prepareData(data.result.series, $("#choicesResponseTimesOverTime"));
            var options = this.getOptions();
            prepareOptions(options, data);
            $.plot($("#flotResponseTimesOverTime"), dataset, options);
            // setup overview
            $.plot($("#overviewResponseTimesOverTime"), dataset, prepareOverviewOptions(options));
        }
};

// Response Times Over Time
function refreshResponseTimeOverTime(fixTimestamps) {
    var infos = responseTimesOverTimeInfos;
    prepareSeries(infos.data);
    if(infos.data.result.series.length == 0) {
        setEmptyGraph("#bodyResponseTimeOverTime");
        return;
    }
    if(fixTimestamps) {
        fixTimeStamps(infos.data.result.series, 28800000);
    }
    if(isGraph($("#flotResponseTimesOverTime"))){
        infos.createGraph();
    }else{
        var choiceContainer = $("#choicesResponseTimesOverTime");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        setGraphZoomable("#flotResponseTimesOverTime", "#overviewResponseTimesOverTime");
        $('#footerResponseTimesOverTime .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
};

var latenciesOverTimeInfos = {
        data: {"result": {"minY": 166.827333333333, "minX": 1.71041364E12, "maxY": 166.827333333333, "series": [{"data": [[1.71041364E12, 166.827333333333]], "isOverall": false, "label": "Redis查询HTTP请求", "isController": false}], "supportsControllersDiscrimination": true, "granularity": 60000, "maxX": 1.71041364E12, "title": "Latencies Over Time"}},
        getOptions: function() {
            return {
                series: {
                    lines: {
                        show: true
                    },
                    points: {
                        show: true
                    }
                },
                xaxis: {
                    mode: "time",
                    timeformat: getTimeFormat(this.data.result.granularity),
                    axisLabel: getElapsedTimeLabel(this.data.result.granularity),
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                yaxis: {
                    axisLabel: "Average response latencies in ms",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                legend: {
                    noColumns: 2,
                    show: true,
                    container: '#legendLatenciesOverTime'
                },
                selection: {
                    mode: 'xy'
                },
                grid: {
                    hoverable: true // IMPORTANT! this is needed for tooltip to
                                    // work
                },
                tooltip: true,
                tooltipOpts: {
                    content: "%s : at %x Average latency was %y ms"
                }
            };
        },
        createGraph: function () {
            var data = this.data;
            var dataset = prepareData(data.result.series, $("#choicesLatenciesOverTime"));
            var options = this.getOptions();
            prepareOptions(options, data);
            $.plot($("#flotLatenciesOverTime"), dataset, options);
            // setup overview
            $.plot($("#overviewLatenciesOverTime"), dataset, prepareOverviewOptions(options));
        }
};

// Latencies Over Time
function refreshLatenciesOverTime(fixTimestamps) {
    var infos = latenciesOverTimeInfos;
    prepareSeries(infos.data);
    if(infos.data.result.series.length == 0) {
        setEmptyGraph("#bodyLatenciesOverTime");
        return;
    }
    if(fixTimestamps) {
        fixTimeStamps(infos.data.result.series, 28800000);
    }
    if(isGraph($("#flotLatenciesOverTime"))) {
        infos.createGraph();
    }else {
        var choiceContainer = $("#choicesLatenciesOverTime");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        setGraphZoomable("#flotLatenciesOverTime", "#overviewLatenciesOverTime");
        $('#footerLatenciesOverTime .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
};

var connectTimeOverTimeInfos = {
        data: {"result": {"minY": 7.4790000000000285, "minX": 1.71041364E12, "maxY": 7.4790000000000285, "series": [{"data": [[1.71041364E12, 7.4790000000000285]], "isOverall": false, "label": "Redis查询HTTP请求", "isController": false}], "supportsControllersDiscrimination": true, "granularity": 60000, "maxX": 1.71041364E12, "title": "Connect Time Over Time"}},
        getOptions: function() {
            return {
                series: {
                    lines: {
                        show: true
                    },
                    points: {
                        show: true
                    }
                },
                xaxis: {
                    mode: "time",
                    timeformat: getTimeFormat(this.data.result.granularity),
                    axisLabel: getConnectTimeLabel(this.data.result.granularity),
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                yaxis: {
                    axisLabel: "Average Connect Time in ms",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                legend: {
                    noColumns: 2,
                    show: true,
                    container: '#legendConnectTimeOverTime'
                },
                selection: {
                    mode: 'xy'
                },
                grid: {
                    hoverable: true // IMPORTANT! this is needed for tooltip to
                                    // work
                },
                tooltip: true,
                tooltipOpts: {
                    content: "%s : at %x Average connect time was %y ms"
                }
            };
        },
        createGraph: function () {
            var data = this.data;
            var dataset = prepareData(data.result.series, $("#choicesConnectTimeOverTime"));
            var options = this.getOptions();
            prepareOptions(options, data);
            $.plot($("#flotConnectTimeOverTime"), dataset, options);
            // setup overview
            $.plot($("#overviewConnectTimeOverTime"), dataset, prepareOverviewOptions(options));
        }
};

// Connect Time Over Time
function refreshConnectTimeOverTime(fixTimestamps) {
    var infos = connectTimeOverTimeInfos;
    prepareSeries(infos.data);
    if(infos.data.result.series.length == 0) {
        setEmptyGraph("#bodyConnectTimeOverTime");
        return;
    }
    if(fixTimestamps) {
        fixTimeStamps(infos.data.result.series, 28800000);
    }
    if(isGraph($("#flotConnectTimeOverTime"))) {
        infos.createGraph();
    }else {
        var choiceContainer = $("#choicesConnectTimeOverTime");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        setGraphZoomable("#flotConnectTimeOverTime", "#overviewConnectTimeOverTime");
        $('#footerConnectTimeOverTime .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
};

var responseTimePercentilesOverTimeInfos = {
        data: {"result": {"minY": 1.0, "minX": 1.71041364E12, "maxY": 711.0, "series": [{"data": [[1.71041364E12, 711.0]], "isOverall": false, "label": "Max", "isController": false}, {"data": [[1.71041364E12, 313.0]], "isOverall": false, "label": "90th percentile", "isController": false}, {"data": [[1.71041364E12, 685.9899999999998]], "isOverall": false, "label": "99th percentile", "isController": false}, {"data": [[1.71041364E12, 358.0]], "isOverall": false, "label": "95th percentile", "isController": false}, {"data": [[1.71041364E12, 1.0]], "isOverall": false, "label": "Min", "isController": false}, {"data": [[1.71041364E12, 171.0]], "isOverall": false, "label": "Median", "isController": false}], "supportsControllersDiscrimination": false, "granularity": 60000, "maxX": 1.71041364E12, "title": "Response Time Percentiles Over Time (successful requests only)"}},
        getOptions: function() {
            return {
                series: {
                    lines: {
                        show: true,
                        fill: true
                    },
                    points: {
                        show: true
                    }
                },
                xaxis: {
                    mode: "time",
                    timeformat: getTimeFormat(this.data.result.granularity),
                    axisLabel: getElapsedTimeLabel(this.data.result.granularity),
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                yaxis: {
                    axisLabel: "Response Time in ms",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                legend: {
                    noColumns: 2,
                    show: true,
                    container: '#legendResponseTimePercentilesOverTime'
                },
                selection: {
                    mode: 'xy'
                },
                grid: {
                    hoverable: true // IMPORTANT! this is needed for tooltip to
                                    // work
                },
                tooltip: true,
                tooltipOpts: {
                    content: "%s : at %x Response time was %y ms"
                }
            };
        },
        createGraph: function () {
            var data = this.data;
            var dataset = prepareData(data.result.series, $("#choicesResponseTimePercentilesOverTime"));
            var options = this.getOptions();
            prepareOptions(options, data);
            $.plot($("#flotResponseTimePercentilesOverTime"), dataset, options);
            // setup overview
            $.plot($("#overviewResponseTimePercentilesOverTime"), dataset, prepareOverviewOptions(options));
        }
};

// Response Time Percentiles Over Time
function refreshResponseTimePercentilesOverTime(fixTimestamps) {
    var infos = responseTimePercentilesOverTimeInfos;
    prepareSeries(infos.data);
    if(fixTimestamps) {
        fixTimeStamps(infos.data.result.series, 28800000);
    }
    if(isGraph($("#flotResponseTimePercentilesOverTime"))) {
        infos.createGraph();
    }else {
        var choiceContainer = $("#choicesResponseTimePercentilesOverTime");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        setGraphZoomable("#flotResponseTimePercentilesOverTime", "#overviewResponseTimePercentilesOverTime");
        $('#footerResponseTimePercentilesOverTime .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
};


var responseTimeVsRequestInfos = {
    data: {"result": {"minY": 156.0, "minX": 1013.0, "maxY": 222.0, "series": [{"data": [[1013.0, 222.0], [1987.0, 156.0]], "isOverall": false, "label": "Successes", "isController": false}], "supportsControllersDiscrimination": false, "granularity": 1000, "maxX": 1987.0, "title": "Response Time Vs Request"}},
    getOptions: function() {
        return {
            series: {
                lines: {
                    show: false
                },
                points: {
                    show: true
                }
            },
            xaxis: {
                axisLabel: "Global number of requests per second",
                axisLabelUseCanvas: true,
                axisLabelFontSizePixels: 12,
                axisLabelFontFamily: 'Verdana, Arial',
                axisLabelPadding: 20,
            },
            yaxis: {
                axisLabel: "Median Response Time in ms",
                axisLabelUseCanvas: true,
                axisLabelFontSizePixels: 12,
                axisLabelFontFamily: 'Verdana, Arial',
                axisLabelPadding: 20,
            },
            legend: {
                noColumns: 2,
                show: true,
                container: '#legendResponseTimeVsRequest'
            },
            selection: {
                mode: 'xy'
            },
            grid: {
                hoverable: true // IMPORTANT! this is needed for tooltip to work
            },
            tooltip: true,
            tooltipOpts: {
                content: "%s : Median response time at %x req/s was %y ms"
            },
            colors: ["#9ACD32", "#FF6347"]
        };
    },
    createGraph: function () {
        var data = this.data;
        var dataset = prepareData(data.result.series, $("#choicesResponseTimeVsRequest"));
        var options = this.getOptions();
        prepareOptions(options, data);
        $.plot($("#flotResponseTimeVsRequest"), dataset, options);
        // setup overview
        $.plot($("#overviewResponseTimeVsRequest"), dataset, prepareOverviewOptions(options));

    }
};

// Response Time vs Request
function refreshResponseTimeVsRequest() {
    var infos = responseTimeVsRequestInfos;
    prepareSeries(infos.data);
    if (isGraph($("#flotResponseTimeVsRequest"))){
        infos.createGraph();
    }else{
        var choiceContainer = $("#choicesResponseTimeVsRequest");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        setGraphZoomable("#flotResponseTimeVsRequest", "#overviewResponseTimeVsRequest");
        $('#footerResponseRimeVsRequest .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
};


var latenciesVsRequestInfos = {
    data: {"result": {"minY": 151.0, "minX": 1013.0, "maxY": 201.0, "series": [{"data": [[1013.0, 201.0], [1987.0, 151.0]], "isOverall": false, "label": "Successes", "isController": false}], "supportsControllersDiscrimination": false, "granularity": 1000, "maxX": 1987.0, "title": "Latencies Vs Request"}},
    getOptions: function() {
        return{
            series: {
                lines: {
                    show: false
                },
                points: {
                    show: true
                }
            },
            xaxis: {
                axisLabel: "Global number of requests per second",
                axisLabelUseCanvas: true,
                axisLabelFontSizePixels: 12,
                axisLabelFontFamily: 'Verdana, Arial',
                axisLabelPadding: 20,
            },
            yaxis: {
                axisLabel: "Median Latency in ms",
                axisLabelUseCanvas: true,
                axisLabelFontSizePixels: 12,
                axisLabelFontFamily: 'Verdana, Arial',
                axisLabelPadding: 20,
            },
            legend: { noColumns: 2,show: true, container: '#legendLatencyVsRequest' },
            selection: {
                mode: 'xy'
            },
            grid: {
                hoverable: true // IMPORTANT! this is needed for tooltip to work
            },
            tooltip: true,
            tooltipOpts: {
                content: "%s : Median Latency time at %x req/s was %y ms"
            },
            colors: ["#9ACD32", "#FF6347"]
        };
    },
    createGraph: function () {
        var data = this.data;
        var dataset = prepareData(data.result.series, $("#choicesLatencyVsRequest"));
        var options = this.getOptions();
        prepareOptions(options, data);
        $.plot($("#flotLatenciesVsRequest"), dataset, options);
        // setup overview
        $.plot($("#overviewLatenciesVsRequest"), dataset, prepareOverviewOptions(options));
    }
};

// Latencies vs Request
function refreshLatenciesVsRequest() {
        var infos = latenciesVsRequestInfos;
        prepareSeries(infos.data);
        if(isGraph($("#flotLatenciesVsRequest"))){
            infos.createGraph();
        }else{
            var choiceContainer = $("#choicesLatencyVsRequest");
            createLegend(choiceContainer, infos);
            infos.createGraph();
            setGraphZoomable("#flotLatenciesVsRequest", "#overviewLatenciesVsRequest");
            $('#footerLatenciesVsRequest .legendColorBox > div').each(function(i){
                $(this).clone().prependTo(choiceContainer.find("li").eq(i));
            });
        }
};

var hitsPerSecondInfos = {
        data: {"result": {"minY": 50.0, "minX": 1.71041364E12, "maxY": 50.0, "series": [{"data": [[1.71041364E12, 50.0]], "isOverall": false, "label": "hitsPerSecond", "isController": false}], "supportsControllersDiscrimination": false, "granularity": 60000, "maxX": 1.71041364E12, "title": "Hits Per Second"}},
        getOptions: function() {
            return {
                series: {
                    lines: {
                        show: true
                    },
                    points: {
                        show: true
                    }
                },
                xaxis: {
                    mode: "time",
                    timeformat: getTimeFormat(this.data.result.granularity),
                    axisLabel: getElapsedTimeLabel(this.data.result.granularity),
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                yaxis: {
                    axisLabel: "Number of hits / sec",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20
                },
                legend: {
                    noColumns: 2,
                    show: true,
                    container: "#legendHitsPerSecond"
                },
                selection: {
                    mode : 'xy'
                },
                grid: {
                    hoverable: true // IMPORTANT! this is needed for tooltip to
                                    // work
                },
                tooltip: true,
                tooltipOpts: {
                    content: "%s at %x was %y.2 hits/sec"
                }
            };
        },
        createGraph: function createGraph() {
            var data = this.data;
            var dataset = prepareData(data.result.series, $("#choicesHitsPerSecond"));
            var options = this.getOptions();
            prepareOptions(options, data);
            $.plot($("#flotHitsPerSecond"), dataset, options);
            // setup overview
            $.plot($("#overviewHitsPerSecond"), dataset, prepareOverviewOptions(options));
        }
};

// Hits per second
function refreshHitsPerSecond(fixTimestamps) {
    var infos = hitsPerSecondInfos;
    prepareSeries(infos.data);
    if(fixTimestamps) {
        fixTimeStamps(infos.data.result.series, 28800000);
    }
    if (isGraph($("#flotHitsPerSecond"))){
        infos.createGraph();
    }else{
        var choiceContainer = $("#choicesHitsPerSecond");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        setGraphZoomable("#flotHitsPerSecond", "#overviewHitsPerSecond");
        $('#footerHitsPerSecond .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
}

var codesPerSecondInfos = {
        data: {"result": {"minY": 50.0, "minX": 1.71041364E12, "maxY": 50.0, "series": [{"data": [[1.71041364E12, 50.0]], "isOverall": false, "label": "200", "isController": false}], "supportsControllersDiscrimination": false, "granularity": 60000, "maxX": 1.71041364E12, "title": "Codes Per Second"}},
        getOptions: function(){
            return {
                series: {
                    lines: {
                        show: true
                    },
                    points: {
                        show: true
                    }
                },
                xaxis: {
                    mode: "time",
                    timeformat: getTimeFormat(this.data.result.granularity),
                    axisLabel: getElapsedTimeLabel(this.data.result.granularity),
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                yaxis: {
                    axisLabel: "Number of responses / sec",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                legend: {
                    noColumns: 2,
                    show: true,
                    container: "#legendCodesPerSecond"
                },
                selection: {
                    mode: 'xy'
                },
                grid: {
                    hoverable: true // IMPORTANT! this is needed for tooltip to
                                    // work
                },
                tooltip: true,
                tooltipOpts: {
                    content: "Number of Response Codes %s at %x was %y.2 responses / sec"
                }
            };
        },
    createGraph: function() {
        var data = this.data;
        var dataset = prepareData(data.result.series, $("#choicesCodesPerSecond"));
        var options = this.getOptions();
        prepareOptions(options, data);
        $.plot($("#flotCodesPerSecond"), dataset, options);
        // setup overview
        $.plot($("#overviewCodesPerSecond"), dataset, prepareOverviewOptions(options));
    }
};

// Codes per second
function refreshCodesPerSecond(fixTimestamps) {
    var infos = codesPerSecondInfos;
    prepareSeries(infos.data);
    if(fixTimestamps) {
        fixTimeStamps(infos.data.result.series, 28800000);
    }
    if(isGraph($("#flotCodesPerSecond"))){
        infos.createGraph();
    }else{
        var choiceContainer = $("#choicesCodesPerSecond");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        setGraphZoomable("#flotCodesPerSecond", "#overviewCodesPerSecond");
        $('#footerCodesPerSecond .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
};

var transactionsPerSecondInfos = {
        data: {"result": {"minY": 50.0, "minX": 1.71041364E12, "maxY": 50.0, "series": [{"data": [[1.71041364E12, 50.0]], "isOverall": false, "label": "Redis查询HTTP请求-success", "isController": false}], "supportsControllersDiscrimination": true, "granularity": 60000, "maxX": 1.71041364E12, "title": "Transactions Per Second"}},
        getOptions: function(){
            return {
                series: {
                    lines: {
                        show: true
                    },
                    points: {
                        show: true
                    }
                },
                xaxis: {
                    mode: "time",
                    timeformat: getTimeFormat(this.data.result.granularity),
                    axisLabel: getElapsedTimeLabel(this.data.result.granularity),
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                yaxis: {
                    axisLabel: "Number of transactions / sec",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20
                },
                legend: {
                    noColumns: 2,
                    show: true,
                    container: "#legendTransactionsPerSecond"
                },
                selection: {
                    mode: 'xy'
                },
                grid: {
                    hoverable: true // IMPORTANT! this is needed for tooltip to
                                    // work
                },
                tooltip: true,
                tooltipOpts: {
                    content: "%s at %x was %y transactions / sec"
                }
            };
        },
    createGraph: function () {
        var data = this.data;
        var dataset = prepareData(data.result.series, $("#choicesTransactionsPerSecond"));
        var options = this.getOptions();
        prepareOptions(options, data);
        $.plot($("#flotTransactionsPerSecond"), dataset, options);
        // setup overview
        $.plot($("#overviewTransactionsPerSecond"), dataset, prepareOverviewOptions(options));
    }
};

// Transactions per second
function refreshTransactionsPerSecond(fixTimestamps) {
    var infos = transactionsPerSecondInfos;
    prepareSeries(infos.data);
    if(infos.data.result.series.length == 0) {
        setEmptyGraph("#bodyTransactionsPerSecond");
        return;
    }
    if(fixTimestamps) {
        fixTimeStamps(infos.data.result.series, 28800000);
    }
    if(isGraph($("#flotTransactionsPerSecond"))){
        infos.createGraph();
    }else{
        var choiceContainer = $("#choicesTransactionsPerSecond");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        setGraphZoomable("#flotTransactionsPerSecond", "#overviewTransactionsPerSecond");
        $('#footerTransactionsPerSecond .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
};

var totalTPSInfos = {
        data: {"result": {"minY": 50.0, "minX": 1.71041364E12, "maxY": 50.0, "series": [{"data": [[1.71041364E12, 50.0]], "isOverall": false, "label": "Transaction-success", "isController": false}, {"data": [], "isOverall": false, "label": "Transaction-failure", "isController": false}], "supportsControllersDiscrimination": true, "granularity": 60000, "maxX": 1.71041364E12, "title": "Total Transactions Per Second"}},
        getOptions: function(){
            return {
                series: {
                    lines: {
                        show: true
                    },
                    points: {
                        show: true
                    }
                },
                xaxis: {
                    mode: "time",
                    timeformat: getTimeFormat(this.data.result.granularity),
                    axisLabel: getElapsedTimeLabel(this.data.result.granularity),
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20,
                },
                yaxis: {
                    axisLabel: "Number of transactions / sec",
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial',
                    axisLabelPadding: 20
                },
                legend: {
                    noColumns: 2,
                    show: true,
                    container: "#legendTotalTPS"
                },
                selection: {
                    mode: 'xy'
                },
                grid: {
                    hoverable: true // IMPORTANT! this is needed for tooltip to
                                    // work
                },
                tooltip: true,
                tooltipOpts: {
                    content: "%s at %x was %y transactions / sec"
                },
                colors: ["#9ACD32", "#FF6347"]
            };
        },
    createGraph: function () {
        var data = this.data;
        var dataset = prepareData(data.result.series, $("#choicesTotalTPS"));
        var options = this.getOptions();
        prepareOptions(options, data);
        $.plot($("#flotTotalTPS"), dataset, options);
        // setup overview
        $.plot($("#overviewTotalTPS"), dataset, prepareOverviewOptions(options));
    }
};

// Total Transactions per second
function refreshTotalTPS(fixTimestamps) {
    var infos = totalTPSInfos;
    // We want to ignore seriesFilter
    prepareSeries(infos.data, false, true);
    if(fixTimestamps) {
        fixTimeStamps(infos.data.result.series, 28800000);
    }
    if(isGraph($("#flotTotalTPS"))){
        infos.createGraph();
    }else{
        var choiceContainer = $("#choicesTotalTPS");
        createLegend(choiceContainer, infos);
        infos.createGraph();
        setGraphZoomable("#flotTotalTPS", "#overviewTotalTPS");
        $('#footerTotalTPS .legendColorBox > div').each(function(i){
            $(this).clone().prependTo(choiceContainer.find("li").eq(i));
        });
    }
};

// Collapse the graph matching the specified DOM element depending the collapsed
// status
function collapse(elem, collapsed){
    if(collapsed){
        $(elem).parent().find(".fa-chevron-up").removeClass("fa-chevron-up").addClass("fa-chevron-down");
    } else {
        $(elem).parent().find(".fa-chevron-down").removeClass("fa-chevron-down").addClass("fa-chevron-up");
        if (elem.id == "bodyBytesThroughputOverTime") {
            if (isGraph($(elem).find('.flot-chart-content')) == false) {
                refreshBytesThroughputOverTime(true);
            }
            document.location.href="#bytesThroughputOverTime";
        } else if (elem.id == "bodyLatenciesOverTime") {
            if (isGraph($(elem).find('.flot-chart-content')) == false) {
                refreshLatenciesOverTime(true);
            }
            document.location.href="#latenciesOverTime";
        } else if (elem.id == "bodyCustomGraph") {
            if (isGraph($(elem).find('.flot-chart-content')) == false) {
                refreshCustomGraph(true);
            }
            document.location.href="#responseCustomGraph";
        } else if (elem.id == "bodyConnectTimeOverTime") {
            if (isGraph($(elem).find('.flot-chart-content')) == false) {
                refreshConnectTimeOverTime(true);
            }
            document.location.href="#connectTimeOverTime";
        } else if (elem.id == "bodyResponseTimePercentilesOverTime") {
            if (isGraph($(elem).find('.flot-chart-content')) == false) {
                refreshResponseTimePercentilesOverTime(true);
            }
            document.location.href="#responseTimePercentilesOverTime";
        } else if (elem.id == "bodyResponseTimeDistribution") {
            if (isGraph($(elem).find('.flot-chart-content')) == false) {
                refreshResponseTimeDistribution();
            }
            document.location.href="#responseTimeDistribution" ;
        } else if (elem.id == "bodySyntheticResponseTimeDistribution") {
            if (isGraph($(elem).find('.flot-chart-content')) == false) {
                refreshSyntheticResponseTimeDistribution();
            }
            document.location.href="#syntheticResponseTimeDistribution" ;
        } else if (elem.id == "bodyActiveThreadsOverTime") {
            if (isGraph($(elem).find('.flot-chart-content')) == false) {
                refreshActiveThreadsOverTime(true);
            }
            document.location.href="#activeThreadsOverTime";
        } else if (elem.id == "bodyTimeVsThreads") {
            if (isGraph($(elem).find('.flot-chart-content')) == false) {
                refreshTimeVsThreads();
            }
            document.location.href="#timeVsThreads" ;
        } else if (elem.id == "bodyCodesPerSecond") {
            if (isGraph($(elem).find('.flot-chart-content')) == false) {
                refreshCodesPerSecond(true);
            }
            document.location.href="#codesPerSecond";
        } else if (elem.id == "bodyTransactionsPerSecond") {
            if (isGraph($(elem).find('.flot-chart-content')) == false) {
                refreshTransactionsPerSecond(true);
            }
            document.location.href="#transactionsPerSecond";
        } else if (elem.id == "bodyTotalTPS") {
            if (isGraph($(elem).find('.flot-chart-content')) == false) {
                refreshTotalTPS(true);
            }
            document.location.href="#totalTPS";
        } else if (elem.id == "bodyResponseTimeVsRequest") {
            if (isGraph($(elem).find('.flot-chart-content')) == false) {
                refreshResponseTimeVsRequest();
            }
            document.location.href="#responseTimeVsRequest";
        } else if (elem.id == "bodyLatenciesVsRequest") {
            if (isGraph($(elem).find('.flot-chart-content')) == false) {
                refreshLatenciesVsRequest();
            }
            document.location.href="#latencyVsRequest";
        }
    }
}

/*
 * Activates or deactivates all series of the specified graph (represented by id parameter)
 * depending on checked argument.
 */
function toggleAll(id, checked){
    var placeholder = document.getElementById(id);

    var cases = $(placeholder).find(':checkbox');
    cases.prop('checked', checked);
    $(cases).parent().children().children().toggleClass("legend-disabled", !checked);

    var choiceContainer;
    if ( id == "choicesBytesThroughputOverTime"){
        choiceContainer = $("#choicesBytesThroughputOverTime");
        refreshBytesThroughputOverTime(false);
    } else if(id == "choicesResponseTimesOverTime"){
        choiceContainer = $("#choicesResponseTimesOverTime");
        refreshResponseTimeOverTime(false);
    }else if(id == "choicesResponseCustomGraph"){
        choiceContainer = $("#choicesResponseCustomGraph");
        refreshCustomGraph(false);
    } else if ( id == "choicesLatenciesOverTime"){
        choiceContainer = $("#choicesLatenciesOverTime");
        refreshLatenciesOverTime(false);
    } else if ( id == "choicesConnectTimeOverTime"){
        choiceContainer = $("#choicesConnectTimeOverTime");
        refreshConnectTimeOverTime(false);
    } else if ( id == "choicesResponseTimePercentilesOverTime"){
        choiceContainer = $("#choicesResponseTimePercentilesOverTime");
        refreshResponseTimePercentilesOverTime(false);
    } else if ( id == "choicesResponseTimePercentiles"){
        choiceContainer = $("#choicesResponseTimePercentiles");
        refreshResponseTimePercentiles();
    } else if(id == "choicesActiveThreadsOverTime"){
        choiceContainer = $("#choicesActiveThreadsOverTime");
        refreshActiveThreadsOverTime(false);
    } else if ( id == "choicesTimeVsThreads"){
        choiceContainer = $("#choicesTimeVsThreads");
        refreshTimeVsThreads();
    } else if ( id == "choicesSyntheticResponseTimeDistribution"){
        choiceContainer = $("#choicesSyntheticResponseTimeDistribution");
        refreshSyntheticResponseTimeDistribution();
    } else if ( id == "choicesResponseTimeDistribution"){
        choiceContainer = $("#choicesResponseTimeDistribution");
        refreshResponseTimeDistribution();
    } else if ( id == "choicesHitsPerSecond"){
        choiceContainer = $("#choicesHitsPerSecond");
        refreshHitsPerSecond(false);
    } else if(id == "choicesCodesPerSecond"){
        choiceContainer = $("#choicesCodesPerSecond");
        refreshCodesPerSecond(false);
    } else if ( id == "choicesTransactionsPerSecond"){
        choiceContainer = $("#choicesTransactionsPerSecond");
        refreshTransactionsPerSecond(false);
    } else if ( id == "choicesTotalTPS"){
        choiceContainer = $("#choicesTotalTPS");
        refreshTotalTPS(false);
    } else if ( id == "choicesResponseTimeVsRequest"){
        choiceContainer = $("#choicesResponseTimeVsRequest");
        refreshResponseTimeVsRequest();
    } else if ( id == "choicesLatencyVsRequest"){
        choiceContainer = $("#choicesLatencyVsRequest");
        refreshLatenciesVsRequest();
    }
    var color = checked ? "black" : "#818181";
    if(choiceContainer != null) {
        choiceContainer.find("label").each(function(){
            this.style.color = color;
        });
    }
}

